Shift design and assignment system

ABSTRACT

A system for shift design and assignment comprises an interface configured to receive scheduling input data which includes labor demand data, worker data, and scheduling configuration data, and a processor configured to generate a set of shift candidates, determine a set of decision variables, determine a cost function, determine a set of constraints, and determine simultaneously, using a SAT, a MP solver, or a MIP solver, a subset of the shift candidates selected in a final schedule and a set of shift assignments of which worker is assigned to which selected shift candidate of the subset of the shift candidates such that the hard constraints are fully respected, violations to the soft constraints are minimized, and the cost function is minimized.

CROSS REFERENCE TO OTHER APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/725,846 entitled SHIFT DESIGN AND ASSIGNMENT SYSTEM filed Dec. 23,2019 which is incorporated herein by reference for all purposes.

BACKGROUND OF THE INVENTION

Scheduling workers to cover demand at a business is a challenging andinefficient process. A large number of constraints exist, includingdetermining a set of shifts to satisfy the demand, assigning workers tothe shifts while respecting workers' availabilities and qualification,avoiding costly overtime for a worker, observing the labor law, unioncontractual rules and company policies, accommodating workers'individual preferences as much as possible, etc. When this process isperformed manually it consumes a great deal of time for the managerinvolved and it is almost impossible to consider the many objectiveswhile ensuring the large number of constraints are not violated. Ideallyan automated solution to this problem could be found, however, solvingsuch a large multidimensional problem is very difficult.

The existing approaches have some critical drawbacks. One existingapproach assumes that the shifts needed to cover the labor demands aregiven and it focuses on assigning workers to the given shifts. Anotherexisting approach is to solve the shift design and shift assignmentsequentially. It first builds a set of shifts to exactly cover the labordemands. It then assigns workers to staff all shifts created. Bothapproaches can miss significant opportunities to create far moreefficient schedule when addressing the shift design and shift assignmentproblem simultaneously. For example, to cover two demands of (1) needing1 cashier from 9:00 am to 1:00 pm on 11/04/2019 and (2) needing 2cashiers from 1:00 pm to 5:00 pm on 11/04/2019, there could be multiplealternatives of shift design. Design A could be having one 8 hours shiftof cashier from 9:00 am to 5:00 pm and one 4 hours shift of cashier from1:00 pm to 4:00 pm. Design B could be having one 4 hours shift ofcashier from 9:00 am to 1:00 pm and two 4 hours shifts of cashier from1:00 pm to 5:00 pm. There could be many more other alternatives as well.Exactly which choice of the shift design would result the most efficientschedule depending on many factors. For example, design A may be a badchoice if your workers who are qualified working as a cashier onlyavailable to work on short shift on that day. Design B may also be a badchoice if one of the cashier workers needs longer shift hours on thatday in order to get her minimum of 20 hours a week contractualguarantee. Addressing shift design and shift assignment separately willmiss many of the opportunities to create a more efficient schedule.

Another existing approach trying to address the drawbacks ofsequentially deciding on shift design and shift assignment by making theshift start time and shift end part of the decision variables instead ofpre-creating the shifts. It does solve the shift design and shiftassignment simultaneously. However, this approach has two majordrawbacks. The labor law governing the meal breaks and short breaks of asingle shift can be arbitrarily complex at various locales. The law canprescribe how long the break needs to be under various conditions andwhen an employer is allowed to place the break (e.g., the meal break hasto be after 2 hours of the shift start and 2 hours before the shift end,etc.). If the shift start time and end time are part of the decisionvariables (i.e., the values will be decided as part of the optimizationprocess of the overall schedule), one will have very limited ability toensure that the resulting shift would conform to the labor law. Onlyvery simple labor law structure can be expressed as part of the shiftdesign decision. The other drawback of this approach is that byincluding shift start time and end time as part of the decisionvariables, the total number of decision variables involved in theresulting problem can be very large even for very a small schedulingproblem. Even with the latest technologies, we cannot solve realisticsize problem.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the followingdetailed description and the accompanying drawings.

FIG. 1 is a block diagram illustrating an embodiment of a shift designand shift assignment system.

FIG. 2 is a block diagram illustrating an embodiment of a schedulingengine.

FIG. 3A is a diagram illustrating an embodiment of worker schedulingdata.

FIG. 3B is a diagram illustrating an embodiment of labor law and unioncontract data.

FIG. 3C is a diagram illustrating an embodiment of company policy andbusiness operation condition data.

FIG. 3D is a diagram illustrating an embodiment of penalty cost data todrive the schedule quality.

FIG. 4 is a diagram illustrating an embodiment of a labor demand.

FIG. 5 is a diagram illustrating an embodiment of a set of shiftcandidates.

FIG. 6 is a flow diagram illustrating an embodiment of a process forshift design and assignment.

FIG. 7 is a flow diagram illustrating an embodiment of a process fordetermining a cost function.

FIG. 8 is a flow diagram illustrating an embodiment of a process fordetermining a set of constraints.

FIG. 9 is a diagram illustrating an embodiment of a user interface forsetting relative weights of the penalty cost.

FIG. 10 is a diagram illustrating an embodiment of the processes withinthe Scheduling Engine.

FIG. 11 is a diagram illustrating an embodiment of the process ofgenerating shift candidates.

FIG. 12 is a diagram illustrating an embodiment of the process ofrelaxing soft constraints and tuning penalty costs to obtain desiredschedule.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as aprocess; an apparatus; a system; a composition of matter; a computerprogram product embodied on a computer readable storage medium; and/or aprocessor, such as a processor configured to execute instructions storedon and/or provided by a memory coupled to the processor. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention. Unless stated otherwise, a component such as aprocessor or a memory described as being configured to perform a taskmay be implemented as a general component that is temporarily configuredto perform the task at a given time or a specific component that ismanufactured to perform the task. As used herein, the term ‘processor’refers to one or more devices, circuits, and/or processing coresconfigured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. The invention is described in connectionwith such embodiments, but the invention is not limited to anyembodiment. The scope of the invention is limited only by the claims andthe invention encompasses numerous alternatives, modifications andequivalents. Numerous specific details are set forth in the followingdescription in order to provide a thorough understanding of theinvention. These details are provided for the purpose of example and theinvention may be practiced according to the claims without some or allof these specific details. For the purpose of clarity, technicalmaterial that is known in the technical fields related to the inventionhas not been described in detail so that the invention is notunnecessarily obscured.

A system for simultaneous shift design and shift assignment isdisclosed. The system comprises an interface and a processor. Theinterface is configured to receive labor demand data, receive workerdata, and receive scheduling configuration data. The processor isconfigured to: generate a set of shift candidates; determine a set ofdecision variables representing whether a particular shift candidate isselected in a final schedule and whether a particular worker is assignedto the particular shift candidate; determine a cost function, whereinthe cost function is expressed at least in part in terms of the set ofdecision variables, a worker cost data of the worker data, and thescheduling configuration data; determine a set of constraints, whereinthe set of constraints comprises hard constraints and soft constraints,wherein the set of constraints is based at least in part on terms of theset of decision variables, the set of shift candidates, the worker data,the labor demand data, and the scheduling configuration data; anddetermine simultaneously, using either a SAT solver, a MP solver, or aMIP solver, a subset of the shift candidates selected in the finalschedule and a set of shift assignments of which worker is assigned towhich selected shift candidate of the subset of the shift candidatessuch that the hard constraints are fully respected, violations to thesoft constraints are minimized, and the cost function is minimized.

This system introduces a novel approach to address the challengesassociated with shift design and shift assignment. The system generatesa set of shift candidates, far more than just enough to cover therequired labor demands. The optimization algorithm selects a subset ofthe shift candidates generated to use and assign a worker to eachselected shift simultaneously in such a way that all relevantconstraints are respected, and the total schedule cost is minimized.This approach allows the system to achieve the economic benefit ofdeciding on the shift design and shift assignment simultaneously. At thesame time, it also allows the system to easily accommodate arbitrarycomplex labor law since the system generates each shift candidateindividually. Once the start time and end time of a shift is given, thesystem is able to verify the conformance to constraints (e.g., labor lawconstraints). The system is designed to take input data and determine aset of decision variables, a set of constraints, and a cost function bytransforming the data to express the shift assignment and shift designproblem enabling solving the problem using an optimization solver.

The system improves the computer by sometimes one or two orders ofmagnitude in speed in being able to simultaneously generate a shiftdesign and shift assignment solution. Without this improvement in speed,the computer is not able to practically determine a shift design andshift assignment solution. With the disclosed system, the computer alsois able to optimize simultaneous shift design and shift assignment togenerate an optimized solution for both aspects of creating a schedule.Also, since the computation is much faster, power consumption and use ofprocessor time are significantly reduced over the ordinary system.

A system for simultaneous shift design and shift assignment transformsinput data to determine an appropriate optimization problem. Theoptimization problem is concerned about making a set of relateddecisions in such a way that a set of given constraints are satisfiedand a utility function (called the objective function) is optimized(e.g., either minimized or maximized depending on the type of theobjective function). Optimization solvers like a Boolean Satisfiability(SAT) solver, a Mathematical Programming (MP) solver, or a Mixed IntegerProgramming (MIP) solver can solve an optimization problem in the orderof one million binary decision variables and one million constraintswith readily accessible resources (e.g. single machine with multiplecores). The optimization problem is determined by transforming the inputdata into a representation of three key elements: (1) a set of decisionvariables, such as x₁, x₂, x₃, . . . , x_(n), and the domain of valuesthat they can take on (e.g., a binary variable can only on value ofeither 0 or 1), (2) a set of constraints expressed in terms of thedecision variables and other known values (called parameter) of thegiven problem (e.g., a worker's hourly pay rate) in the form of a set ofequalities or inequalities, for example, f(x₁, x₂, x₃, . . . ,x_(n))≥50, and (3) an objective function expressed in terms of thedecision variables and known parameters. Once the three elements aredetermined, a SAT solver, a MP solver, or MIP solver can be used tosolve the determined optimization problem. The solver can return one ofthe four answers: (1) an optimal solution is found and it gives thespecific value each decision variable is taking at the optimum and thetotal value of the objective function at the optimum, (2) the problem isfeasible (no solution can be found, the set of constraints inherentconflicts), (3) the time is used up, returns the best near optimalsolution so far, and (4) the given problem is an ill-formed problem(unbounded).

A system for shift design and shift assignment comprises an interfaceconfigured to receive the scheduling input data and a Scheduling Engineto determine the optimal schedule in terms of what shifts the finalschedule should have and which worker is assigned to which shift. Thescheduling input data includes labor demand data, worker data andscheduling configuration data. The labor demand data includes a worker'squalification, a number of workers needed, and a demand start time and ademand end time (i.e., what is needed, how many are needed and when).The worker data includes worker availability data, worker qualificationdata, worker cost data and worker personal preference data. Thescheduling configuration data includes the relevant labor law (such asmeal breaks, overtime pay, etc.), the relevant union contractual rules(such as minimum number of weekly hours, minimum and maximum shiftlength, etc.), company polices/business restrictions (such as weeklybudget amount, delivery truck arrives every two weeks and such thebusiness cycle is every two weeks, etc.), and the configuration datathat drives the schedule quality (such as for every worker preferencenot respected in one shift X amount of penalty cost is incurred, etc.).The scheduling engine determines the optimal schedule by (1) generatinga set of shift candidates based at least in part on the labor demanddata wherein a shift candidate is one working shift for one worker witha specific start/end date/time and the qualification needed for theshift, (2) determining a set of decision variables that represent thedecisions that are needed to determine a final schedule such as whethera shift candidate should be used in the final optimal schedule andwhether one particular worker should be assigned to one particular shiftcandidate, (3) transforming input data to determine the total schedulecost including the labor cost of paying the workers and the penalty costif the final schedule contains any undesirable characteristics (such asnot respecting certain worker's preference, etc.) as a function of thedecision variables (the objective function), (4) transforming input datato determine a set of constraints using the decision variables, whereinthe set of constraints is built based on a set ofconditions/restrictions that are to be respected while determining theoptimal schedule (e.g., the labor demands need to be met, worker'savailability and qualification should be respected, two shifts assignedto one worker cannot overlap, the budget should be respected, etc.), and(5) invoking either a SAT solver, a MP solver, or MIP solver by feedingin the decision variables, the constraints, and the objective functionto determine an optimal solution (if it exists) such that all decisionvariables are taking on appropriate values in such a way that allconstraints are respected and the objective function is minimized (ormaximized if the objective function represents profitability orsomething in that nature) or informing the user that no feasiblesolution can be found with the given information.

The labor demand for a given period is described by a set of demandspecifications, comprising a start time, an end time, the qualificationrequired, and a number of workers needed. For example, on Jul. 11, 2019,from 11:00 AM to 3:00 PM, three cashiers are needed. In someembodiments, a range is used for labor demand—for example, at least twobut no more than four cashiers are needed. A shift candidate comprises acomplete shift for a worker, typically the full working hours for aworker in a day. For example, a shift candidate comprises a start time,an end time, and a qualification (e.g., a cashier on Jul. 11, 2019 from9:00 AM to 5:00 PM). A labor demand specification can require one ormore shift candidates for complete coverage, and one shift candidate cancover at least portion of one demand specification up to multiplecomplete demand specifications. A demand specification is structured todescribe the labor demand effectively. It can have any time duration andit represents one type of resource needed. A shift candidate representsone unit of work to be assigned to one worker. One shift candidate mayalso contain work for multiple qualifications. For example, a shiftcandidate comprises a shift on 7/11/2019 from 8:00 AM to 4:00 PM, wherethe first four hours are as a cashier and the last four hours are as asales associate. A shift requiring multiple qualifications can be usefulin the event there are workers qualified for multiple jobs.

Worker data includes worker availability data (e.g., Tom is available onMonday/Tuesday/Wednesday any time, on Friday and Saturday from 1:00 pmto 10:00 pm, and he is taking vacation days from 11/19/2004 to11/7/2019), worker qualification data (e.g., Tom can work as either acashier or as a sales associate), worker cost data (e.g., Tom's hourlynormal pay rate is $15), and personal preference data (e.g., Tom prefersshifts in hours from 1:00 pm to 6:00 pm and he prefers to obtain morehours as a sales associates rather than a cashier). In addition todemand data and worker data, other configuration data normally specifiedat the organizational level are also used when determining the optimalschedule. Those organizational level configuration data typically belongto one of the following four categories. Category One data are thoseused to describe the relevant labor laws that govern the meal breaks,short break, overtime pay, shift change notification time requirementand penalty cost etc. at a particular locale—for example, in Colorado aworker is given 30 minutes unpaid meal break if a work shift exceeds 5consecutive hours. Category Two data are those used to describe theunion contract—for example, certain part-time worker is guaranteed aminimum of 25 shift hours per week. Category Three data are those usedto describe a company's policy or business operating conditions—forexample, for this particular store the weekly labor budget is $25,000 orthis particular store has business cycle of 2 weeks due to the arrivingof delivery truck every two weeks. Category Four data are those dataused to describe the trade-off decision that an organization is willingto make when determining the optimal schedule—for example, the companywill not violate a worker's preferred time of the day in his/her shiftsunless it can achieve more than $30 cost savings for each violation.These type of penalty costs are used by the solver at the time ofinvoking the optimization algorithm. They can largely influence thequality of the final optimal schedule.

After receiving all the input data, the first thing that the schedulingengine does is to generate a set of shift candidates using a heuristicprimarily based on labor demand specification. For example, given twodemand specifications such as on 11/04/2019 from 9:00 am to 1:00 pmneeding 1 cashier and on 11/04/2019 from 1:00 pm to 5:00 pm needing 2cashiers, the heuristics may generate the following 5 shift candidates:2 identical shift candidates for a cashier going from 9:00 am to 5:00 pmon 11/04/2019 (call it shift candidate type A), 1 shift candidate for acashier going from 9:00 am to 1:00 pm on 11/04/2019 (call it type B) and2 identical shift candidates for a cashier going from 1:00 pm to 5:00 pmon 11/04/2019 (call it type C). The heuristic should conform to thefollowing restrictions: (1) it should generate sufficient shiftcandidates that provide the full coverage of the labor demands andnormally only a subset of the shift candidates is needed in the finalschedule to provide the full demand coverage (e.g., either 2 A or 1 B+2C or 1 A+1 C in the above example); (2) it should generate shiftcandidates that conform to the relevant labor law, union contract andcompany policy that govern a single shift. In the rest of the steps ofscheduling engine's processing, it will select the most effective subsetof the shift candidates to use in the final schedule and to assignappropriate workers to staff the shifts in such as a way that allrelevant constraints are respected and the objective function (of thetotal cost, including the penalty costs) is minimized.

A heuristic may be constructed that generates shift candidates thatprovide sufficient coverage for a given set of demand specificationbased on the following considerations: (1) Shift candidates aregenerated for one day at a time (and mostly for one resource type at atime). The amount of data the algorithm has to deal with is very limited(typically a few demand specifications at a time). In most cases, a fullenumeration is possible as explained in FIG. 5 (see details in latersection). (2) There are many restrictions from labor laws/unioncontract/company policy that govern the single shift. For example, shiftduration has to be within the given minimum and maximum length. Withthose restrictions, the possible shift candidates that need to becreated is reduced. (3) Common sense considerations can guide thedirection to generate useful shift candidates for the solver to selectfrom. For example, for the two demands in the previous illustration (1cashier from 9:00 am to 1:00 pm and 2 cashiers from 1:00 pm to 5:00 pm),generating 2 shift candidates from 9:00 am to 5:00 pm for a cashier maymake sense as it may be that only full-time workers are available totake on the shifts for the duration. Similarly, generating 1 shiftcandidate from 9:00 am to 1:00 pm and 2 shift candidates from 1:00 pm to5:00 pm also makes sense since those three shift candidates would resultthe tightest demand coverage (without any waste of over coverage) if thethree are selected. The final optimal solution can also select 1 shiftcandidate from 9:00 am to 5:00 pm and 1 shift candidate from 1:00 pm to5:00 pm. At the time of generating the shift candidates, it is morerelevant to choose possible candidates. It is the later optimizationprocess that will decide which subset gets selected in order the get theoptimal solution. In some embodiments, the heuristic generates shiftcandidates based on the availability of types of workers (e.g., onlyfull time workers are available so only full time shifts are generated,only part time workers are available so only part time shifts aregenerated, etc.). In some embodiments, the heuristic generates shiftcandidates based on the practical consideration of not having workerstake breaks all at once (e.g., by having staggered meal breaks in theset of shift candidates).

A generated shift candidate is subject to labor law legal constraints,union contract constraints, company policy constraints, etc. Forexample, a union contract can dictate that the duration of a shift hasto be between four and nine hours, or a state law can require a halfhour unpaid meal break for every 5 hours consecutive work. When a shiftcandidate that requires a meal break is generated, the exact timing ofthe meal break is placed on the shift. If alternative placements of themeal break are allowed by the law, each alternative is generated as analternative shift candidate. The later optimization process will selectthe right one to use. For a shift candidate with a meal break, it willnot provide coverage for the labor demand during the period of the mealbreak (typically 30 minutes). It is desirable to place the meal break atdifferent time slot among different shift candidates with the samestart/end time and the same resource type. This will allow the lateroptimization step better opportunity to provide more efficient demandcoverage. Since the shift candidate is evaluated with regard to itsconformance to the labor law or union contract one at a time, it ispossible to determine a transformation of input data into a set validshift candidates no matter how complex the labor law may be. Therefore,for any set of legal or other external constraints on shift design, aset of shift candidates can be constructed wherein each shift candidatesatisfies the constraints and covers at least part of the labor demand.By decoupling the process of generating individual shift candidates thatconform to labor law/union contract/company policy from the optimizationprocess of selecting which subsect of the shift candidates to use in thefinal schedule and assigning workers to the selected shifts, arbitrarycomplexity can be handled in the labor law while not sacrificingefficiency of the final optimal schedule since the shift design decision(which shift to use) and shift assignment decision are madesimultaneously.

The next step for the Scheduling Engine is to form the proper decisionvariables for the shift design and shift assignment problem at hand. Theoptimization algorithm provided by a SAT solver, a MP solver, or a MIPsolver is the process of determining the proper values for the decisionvariables to take on in such a way that all relevant constraints aresatisfied and the objective function is optimized (i.e., total schedulecost is minimized here). Two categories of decision variables areconstructed that correspond to the two types decisions that are beingmade simultaneously, i.e., which subset of the shift candidates shouldbe used in the final optimal schedule and which worker should beassigned to which shift. Let us assume that there are N number ofworkers available to work and M number of shift candidates have beengenerated for the given set of demands in a given scheduling period. Fora worker i of the set of N workers and a shift candidate j of the set ofM shift candidates, binary decision variable is defined as y_(j)=1 inthe event that shift candidate j is selected in the final schedule andy_(j)=0 otherwise, and further the binary decision variable is definedas x_(i,j)=1 in the event that worker i is assigned to shift candidate jand x_(i,j)=0 otherwise. Thus the decision variables x_(i,j) and y_(j)together are able to describe what shape of the shifts that should beused to cover the labor demand (the shift design or shift selection) andwhich worker should work on which shift (the shift assignment). In someembodiments, additional decision variables can be introduced withoutchanging the main structure of the approach that make this systemunique. For example, if it is desired to guarantee that each workershould receive two consecutive days off each week in their schedule, adecision variables can be introduced that represents whether the twodays off for the worker are on Saturday/Sunday, or Sunday/Monday, orMonday/Tuesday, etc.

With the decision variables defined, all relevant constraints in theshift design and shift assignment problem can be determined in the formof a set equalities or inequalities in terms of the decision variablesx_(i,j) and y_(j) and the input data. For example, to ensure that aworker is only assigned to a shift for which he is qualified, thefollowing constraint can be added to the solver: x_(i,j)=0 in the eventworker i does not have the qualification needed for shift candidate j.To respect worker's availability, the following constraint can be addedto the solver: x_(i,j)=0 in the event the entire duration of shiftcandidate j is not fully contained in at least one of the available timesegments of worker i. To ensure that a worker i is not assigned to workin both shift j and shift k that overlap, the following constraint canbe added to the solver: x_(i,j)+x_(i,k)≤1.

A very wide range of business constraints and logical constraints in thedomain of Workforce Scheduling (the problem that shift design and shiftassignment addresses) can be determined using the decision variablesdefined above. Some constraint examples are: demand coverage constraints(e.g., the set of labor demand is satisfied by a set of shift candidatesselected to be used in the final schedule), worker availabilityconstraints (e.g., a worker is only assigned to work on shifts thatshe/he has time available), shift overlap constraints (e.g., a workercan only work one shift at a time), worker rest constraints (e.g.,between two non-overlapping shifts assigned to one worker there shouldbe a minimum amount of rest time to prevent the close/open situation incertain industries, i.e., an employee is assigned to a shift to closethe store very late in a day and another shift to open the store veryearly the next morning), qualified worker constraints (e.g., a worker isonly assigned to shift types that they are qualified for), minimum andmaximum weekly hours constraints (e.g., a worker is guaranteed to beassigned to at least a minimum number of hours and no more than amaximum number of hours per week), weekly budget constraints (e.g., thetotal salary paid to workers per week cannot exceed a budget limit),working five days a week constraints (e.g., full time workers should beassigned to work exactly five days a week), two consecutive days offconstraints (e.g., some workers are guaranteed to have two consecutivedays off every week), and any other appropriate constraints.

Within the set of solutions that satisfy all constraints, an optimal ornear-optimal solution is determined with respect to an objectivefunction (e.g., by minimizing or maximizing the objective function). Forexample, a typical objective function represents the total cost of theschedule, wherein the total cost comprises the real cost of paying theworkers for the schedule and a soft penalty cost that measures thedesirability of the schedule along many dimensions. The real cost of theschedule comprises the sum of a normal pay cost (e.g., a cost related tothe normal—for example, non-overtime and non-premium-time pay) and/or anovertime pay cost and other premium pay (e.g., shift hours at late nightmay be paid at higher than normal). The soft penalty cost comprises, forexample, a schedule consistency cost (e.g., a cost associated withassigning a worker an inconsistent week to week schedule), a workerbelow average skill proficiency cost (e.g., a cost associated withassigning a below average skilled worker to a shift), a worker day andtime preference violation cost (e.g., a cost associated with assigningan employee to a shift outside of his/her days of the week or time ofthe day preferences), a worker weekly scheduled time preferenceviolation cost (e.g., a cost associated with assigning a worker to aweekly scheduled time below or above of his/her weekly scheduled timepreferences), a worker job role preference violation cost (e.g., a costassociated with assigning a worker to a shift associated with job roleoutside of his/her preferred role when the worker is qualified formultiple roles), and/or any other appropriate costs. Each of the costcomponents can be expressed as a function of the decision variables andthe input data.

With the decision variables defined, a set of constraints expressed interms of the decision variables and an objective function (total cost)expressed in terms of the decision variable, the Scheduling Engineinvokes a solver (a SAT solver, a MP solver, or a MIP solver) whichdetermines the optimal value each decision variable should take on insuch a way that all constraints are respected and the objective functionis optimized (in this case the total cost is minimized). In the casethat the solver does not find a solution for the given set ofconstraints, the Scheduling Engine will relax certain constraints andinvoke the solver again with the relaxed problem. When the SchedulingEngine relaxes a constraint, it removes the constraint from the set ofconstraints sent to the solver and adds the amount of the constraintviolation (expressed as a function of the decision variables) multipliedby a penalty cost factor to the objective function. For example,Σ_(j)x_(i,j)(β_(j)−α_(j)−b_(j))≤H_(i) is the maximum weekly hoursconstraint for worker i where (β_(j)−α_(j)−b_(j)) is the paid number ofhours for shift candidate j and H_(i) is the maximum weekly hours forworker i. To relax this constraint, in addition to removing it from theset of constraints, a term c_(i) ^(H) max(0, Σ_(j)x_(i,j)(β_(j)−α_(j)−b_(j))−H_(i)) is added to the objective function ofthe total cost, where c_(i) ^(H) is the hourly penalty cost if theassigned total weekly shift hours is above the maximum weekly hoursH_(i) for worker i. When a constraint is relaxed, the solver will try tofind a solution that respects the remaining constraints and at the sametime minimizes the amount of the violation of the relaxed constraint dueto the penalty cost term added to the objective function. A constraintthat can be relaxed by the Scheduling Engine is called a softconstraint. The order in which the Scheduling Engine may relax varietiesof soft constraints is configurable. For example, if it is moreimportant to cover the labor demands than to conform to maximum weeklyhours for a particular company, the maximum weekly hour constraintswould be relaxed first before relaxing the labor demand coverageconstraint. Most business constraints, such as budget constraints,demand coverage constraints, etc. can be treated as soft constraints.The Scheduling Engine will automatically relax them in a prescribedorder if it cannot find a solution (e.g., as indicated using aprescribed order of relaxation list). Some constraints will never berelaxed, and these are called hard constraints. For example, theconstraint that guards against a worker getting assigned to two shiftsthat overlap will never be relaxed as the resulting solution may violatebasic physics (e.g., a single person cannot be in two places at the sametime).

FIG. 1 is a block diagram illustrating an embodiment of a system forshift design and shift assignment. In the example shown, FIG. 1comprises network 100, employee system 102, administrator system 104,scheduling engine 106, and transaction engine 108 communicating witheach other via network 100. In various embodiments, network 100comprises one or more of the following: a local area network, a widearea network, a wired network, a wireless network, the Internet, anintranet, a storage area network, or any other appropriate communicationnetwork. Employee system 102 is a system for use by an employee. Forexample, employee system 102 comprises a desktop computer, a laptopcomputer, a tablet computer, a smartphone, etc. Employee system 102interacts with the scheduling engine 106 to get schedule relatedquestions for a worker answered or interacts with the transaction engine108 to store and/or to access data related to the worker's schedulingneed. For example, an employee uses employee system 102 to provideemployee preferences data, employee availability data, etc. to thetransaction engine 108. An employee can also use employee system 102 tointeract with scheduling engine 106 to answer questions such as “what ismy schedule for next week?” or “can I swap this shift with others?”,etc. Administrator system 104 is a system for use by an administrator ora manager. An administrator or a manager utilizes administrator system104 to administrate and use a shift design and shift assignmentsystem—for example, installing the applications, configuring theapplications, managing the scheduling configuration data, to requestschedule creation, to refine the schedule, to receive schedule data,etc. Depending on the nature of the interaction, administrator system104 may communicate with (via the network 100) scheduling engine 106 ortransaction engine 108, or both. Scheduling engine 106 manages thescheduling input data using the transaction engine 108 to persist data,generates a set of shift candidates based at least in part on the labordemand, creates an optimal schedule by invoking a SAT, MP, or a MIPsolver, and/or produces an incremental solution if a portion of thescheduling input data is changed. Scheduling engine 106 can read thescheduling input data from the transaction engine 108 and can alsodirectly receive data from the employee system 102 or administratorsystem 104. Transaction engine 108 is responsible for storing andretrieving data from the persistence storage in such a way that itguarantees the transaction integrity during concurrent reads/writes bymultiple users/agents/systems.

FIG. 2 is a block diagram illustrating an embodiment of a SchedulingEngine. In some embodiments, scheduling engine 200 of FIG. 2 comprisesscheduling engine 106 of FIG. 1 . In the example shown, schedulingengine 200 comprises an interface 202 and a processor 208. Interface 202is responsible for communicating with external systems using a networkand managing the scheduling input data. Interface 202 comprises managerinterface 204 and worker interface 206 wherein manager interface 204 candeal with all input data and worker interface 206 deals with workeravailability data, worker preference data and other worker specificdata. Processor 208 is responsible for creating the optimal schedule fora given set of input data. Processor comprises shift candidate generator210, optimization model 212 and solver interface 214. Primarily based onthe labor demand data from interface 202 (e.g., as provided initially bya user using a user system), shift candidate generator 210 generates aset of shift candidates using a heuristic. The generated set of shiftcandidates from 210 along with other input data from 202 are passed tothe optimization model 212 where a set of decision variables, a set ofconstraints and an objective function are constructed. In solverinterface 214, a SAT, MP, or MIP solver is invoked with the fulloptimization model (including decision variables, constraints, and anobjective function). An optimal solution will be obtained (if itexists). If no solution exists, some of the soft constraints will berelaxed and the solver is invoked again with the relaxed problem. Thesolution or indication of no solution is provided to the user using auser system via interface 202. In response to a solution being provided,the user is able to use the provided shift design and shift assignment(e.g., to provide to a worker that will work according to the scheduleprovided as a solution) and/or modify the shift design and shiftassignment by adjusting the input data and resubmitting the input datafor a new solution.

FIG. 3A is a diagram illustrating an embodiment of worker schedulingdata. For example, the diagram of FIG. 3A comprises a summary of workerscheduling data or a user interface for entering worker scheduling data.In the example shown, worker scheduling data 300 comprises a worker nameand a set of qualified worker roles, including worker skill level andpay rate for each role. Worker scheduling data 300 additionallycomprises data to indicate working five days or not (e.g., whether theworker is guaranteed work exactly five days a week), two consecutivedays off data (e.g., whether the worker is guaranteed consecutive twodays off per week), minimum hours per week data, maximum hours per weekdata, preferred hours per week data, available days data, availabletimes data, preferred days data, preferred times data, etc.

FIG. 3B is a diagram illustrating an embodiment of labor laws and unioncontract data. In the examples shown, labor laws that govern meal breakand short break in certain locales are listed in rows of a labor lawtable. Labor laws that govern overtime pay, shift change notificationrules, and penalty payments are also listed in rows of a labor lawtable. A union contract table is also shown, illustrating union rulesassociated with shift minimum/maximum length and min/max weekly hours.There can be many more types of labor laws and union contract rules. Insome embodiments, labor laws and/or union contract rules relate tosingle shifts and the pay for workers under various conditions.

FIG. 3C is a diagram illustrating an embodiment of company policy andoperation conditions that impact scheduling. In the example shown, atable includes rows describing a company policy for rest days, a budgetlimit, and an organization cycle (e.g., a schedule repeat pattern—forexample, every two weeks). The table includes data that can impact whatconstraints should be enforced and how.

FIG. 3D is a diagram illustrating an embodiment of penalty costconfigurations that are used to influence the schedule quality. In theexample shown, a table includes rows describing penalty costs associatedwith schedule consistency, a worker's timing preference, a worker'stotal weekly hours' preference, a worker's role preference, and leavingdemand uncovered. By varying the penalty costs, different shapes of thefinal schedule can be obtained from the solver.

FIG. 4 is a diagram illustrating an embodiment of a labor demandspecification. In some embodiments, labor demand of FIG. 4 is input tothe Scheduling Engine 106 of FIG. 1 as a labor demand. For example,labor demand 400 of FIG. 4 comprises the number of workers needed forthe cashier role on a particular day in one hour increments for ascheduling organization. In the example shown, labor demand 400comprises a number of required workers for a period of time. In someembodiments, labor demand 400 comprises a range of required workers fora period of time (e.g., a minimum number of required workers and amaximum number of required workers at each time). In the example shown,demand is shown from 9:00 AM until 5:00 PM in one hour increments. Twoworkers as cashiers are required from 9:00 AM to 10:00 AM, 3 workers ascashiers are required from 10:00 AM to 11:00 AM and from 4:00 PM to 5:00PM, and 4 workers as cashiers are required from 11:00 AM to 12:00, 12:00PM to 1:00 PM, 1:00 PM to 2:00 PM, 2:00 PM to 3:00 PM, and 3:00 PM to4:00 PM.

FIG. 5 is a diagram illustrating an embodiment of a set of shiftcandidates. In some embodiments, the set of shift candidates of FIG. 5is generated by Shift Candidate Generator 210 of FIG. 2 . In the exampleshown, the set of shift candidates 500 comprises a group of shiftcandidates generated from a heuristic (e.g., the full enumeration of allpossible shifts starting from one hour long shifts up to eight hourslong shifts with one hour increment). Each shift candidate of set ofshift candidates 500 comprises a potential worker shift (e.g., where theshift is defined by a specific start/end time and has the requiredqualification for one worker to fill), from a minimum length shift(e.g., a 1 hour shift) to a maximum length shift (e.g., an 8 hourshift). For example, C1, C2, C3, C4, C5, C6, C7, and C8 comprise onehour long possible shift candidates starting at 9 AM, 10 AM, 11 AM, 12PM, 1 PM, 2 PM, 3 PM, and 4 PM, respectively; C9, C13, C10, C14, C11,C15, and C12 comprise two hour long possible shift candidates startingat 9 AM, 10 AM, 11 AM, 12 PM, 1 PM, 2 PM, and 3 PM, respectively; C16,C18, C20, C17, C19, and C21 comprise three hour long possible shiftcandidates starting at 9 AM, 10 AM, 11 AM, 12 PM, 1 PM, and 2 PM,respectively; C22, C24, C25, C26, and C23 comprise four hour longpossible shift candidates starting at 9 AM, 10 AM, 11 AM, 12 PM, and 1PM, respectively; C27, C28, C29, and C30 comprise five hour longpossible shift candidates starting at 9 AM, 10 AM, 11 AM, and 12 PM,respectively; C31, C32, and C33 comprise six hour long possible shiftcandidates starting at 9 AM, 10 AM, and 11 AM, respectively; C34 and C35comprise seven hour long possible shift candidates starting at 9 AM and10 AM, respectively; and C36 comprises an eight hour long possible shiftcandidate starting at 9 AM. In some embodiments, each shift candidate asillustrated in 500 has multiple instances of identical start/end timeand resource type up to the amount of the corresponding labor demandamount at the time. For example, shift candidate C1 starting at 9:00 am,ending at 10:00 am for a cashier can have up to two identical instancesas the corresponding labor demand amount in 400 of FIG. 4 from 9:00 amto 10:00 am for cashier is two.

The set of shift candidates 500 must be at least able to cover all labordemand in 400 of FIG. 4 , e.g, if every one of the shift candidates isassigned with a proper worker, the original labor demand will be morethan sufficiently covered. In most cases, only a small subset of theshift candidates needs to be assigned a worker to fulfill the labordemand. For example, if only all one hour long shift candidates C1through C8 are selected with all their corresponding identicalreplication instances, the labor demand in the example in 400 of FIG. 4would be completely covered. The set of shift candidates 500 is normallyfiltered to remove shift candidates that do not conform to shiftregulations (e.g., labor law, union contract, etc.). When a shiftcandidate is long enough to require a meal break or any other type ofbreak, the meal break is properly inserted according the labor law. Forexample, if the labor law requires half hour meal break for any shiftthat is longer than six hours (e.g., shift candidates C31 through C36 in500 and their corresponding replications with the same shiftstarting/ending time) would have a half hour meal break placed at theright time allowed by the law. When this happens, during thecorresponding half hour meal break, the shift candidate does not provideany labor demand coverage expressed in 400 of FIG. 4 . When thereplication instances are generated with identical shift start/end time,the meal break is placed at different time slots (within the rangeallowed by the law) so that the replications can provide stronger labordemand coverage when used together. For example, the meal breaks may beplaced for five replications of C36 from 11:30 am to 2:00 pm, one forevery half hour. This way, the five replications of C36 can provide thecomplete coverage of 4 cashiers any time from 9:00 am to 5:00 pmexpressed in 400 of FIG. 4 . In some embodiments, the set of shiftcandidates 500 only contains a small subset of all possible shiftcandidates due to the filter conditions of being valid for labor law,union contract, and/or company policy and/or including variations of theshift candidates for breaks at different times within the shiftcandidates.

Normally a full enumeration of all the possible shift candidates for agiven demand specification is not necessary to obtain high qualityoptimal schedule. Various heuristics can be used to generate shiftcandidates that are more likely to be used in the final schedule. Also,union rules or company policies may also limit the shift length to bewithin certain minimum and maximum durations. In some embodiments, ashift candidate may cover multiple labor demand types. For example,there may be a shift candidate from 9:00 am to 5:00 pm in which thefirst 3 hours is for a cashier role and the last 5 hours for a salesassociate role. This type of shift candidate is generated when there islabor demand for multiple roles and there are workers who are qualifiedfor multiple roles. The advantage of the system is that the shiftcandidate generation does not have to be perfect as long as it generatesenough of shift candidates (which is verifiable). It is the lateroptimization step that will select the right subset of the shiftcandidates to use in the final schedule so that all constraints(including the labor demand coverage constraints) are respected, and thetotal cost is minimized.

FIG. 6 is a flow diagram illustrating an embodiment of a process forschedule creation by the Scheduling Engine 106 of FIG. 1 . In theexample shown, in 602 almost all the scheduling input data illustratedin FIG. 3A-D (with the only exception of employee preference data) canbe edited by an administrator or a manager. In 604, worker preferenceand availability data can be edited by individual workers. In 606, a setof shift candidates is generated as illustrated in FIG. 5 . In 608, aset of decision variables are formed with the primary categories ofdecision variables being the shift candidate selection binary decisionvariables and the shift assignment binary decision variables. Fromthere, control passes to 610 and 612 to build a set of constraints andan objective function respectively using the decision variables and thescheduling input data. Once the constraints and objective function arebuilt, the solver 614 is invoked with the optimization model (e.g., thedecision variables, the set of constraints and the objective function).The solver will try to find a solution that optimize the objectivefunction (e.g., minimizing the total cost) while respecting all thegiven constraints. In 616, the system tests if the solver fails to finda solution, in the event that it is not feasible to find a solution, itwill indicate that the given problem is infeasible, and control passesto 618 where certain soft constraints will be relaxed based on the orderprescribed by the user (e.g., relax max hour per week constraints firstbefore relaxing the demand coverage constraint). When a constraint isrelaxed, it is removed from the set of constraints 610 and thecorresponding constraint violation is added as a penalty cost term tothe objective function 612. If in the test of 616 a feasible solution isfound, the quality of the solution will be assessed in 620. This can bedone either objectively by using the pre-configured criteria (e.g., atleast 95% of the demand is covered and spending is within 2% of thegiven budget, etc.) or manually judged by the user through the examiningof the resulting schedule. If the schedule quality is not good enough(e.g., only 40% of workers' preferences are respected), the control ispassed to 622 to adjust the corresponding penalty cost weight of aparticular term in the objective function and new objective function isformed in 612 (as will be illustrated in FIG. 9 later). In the eventthat the schedule quality is good, the final schedule is presented tothe user in 624. For any practical scheduling problem, once certainnumber of constraints are relaxed (such as demand coverage constraintand minimum weekly hour constraints), a feasible solution is alwaysfound.

FIG. 7 is a flow diagram illustrating an embodiment of a process forexpressing total schedule cost as a function of the decision variablesand the scheduling input data. In some embodiments, the process of FIG.7 implements 612 of FIG. 6 . In the example shown, in 700, the laborcost is expressed as a function of shift assignment decision x_(i,j) andother input data. The system transforms the input data to generate thefunction enabling the use of an optimization calculation. For example,let T be all the days in a particular scheduling period underconsideration, W be the set of all workers, S be the set of shiftcandidates generated, q_(D), q_(W) be the daily and weekly hour limitabove which an overtime rate is incurred, p_(i) be the normal hourly payrate for worker i, θ be the overtime rate relative to the normal rate,α_(j) be the start time of shift j, β_(j) be the end time of shift j,b_(j) be an amount of unpaid break time during shift j, g_(j,l)=1 in theevent that shift j is within day l, and G_(j,L)=1 in the event thatshift j is within week L. Worker i on day l workst_(i,l)=Σ_(j∈S)x_(i,j)(β_(j)−α_(j)−b_(j))g_(j,l) hours and is paidt_(i,l)p_(i) in the event that t_(i,l)≤q_(D) ort_(i,l)p_(i)+(t_(i,l)−q_(D))(θ−1)p_(i) in the event that t_(i,l)≥q_(D).Utilizing a function max(0, y) defined as max(0, y)=y when y>0 andmax(0, y)=0 when y≤0, the total pay for worker i would beΣ_(l∈T)[t_(i,l)p_(i)+max(0, t_(i,l)q_(D))(θ−1)p_(i)] if the weeklyovertime pay is not considered. Worker i in week L workst_(i,L)=Σ_(j∈S)x_(i,j)(β_(j)−α_(j)−b_(j))G_(j,L) hours. For worker i thetotal overtime hours due to the weekly hour limit, without doublecounting with the daily limit, for week L will be max(0,t_(i,L)−q_(W)−Σ_(l∈L) max(0, t_(i,l)−q_(D))). The labor cost for allworkers for the entire scheduling period thus can be expressed asC₁=Σ_(i∈w){Σ_(l∈T)t_(i,l)p_(i)+[Σ_(l∈T) max(0, t_(i,l)−q_(D))+Σ_(L∈T)max(0, t_(i,L)−q_(W)−Σ_(l∈L) max(0, t_(i,l)−q_(D)))](θ−1)p_(i)}. If aparticular shift has premium pay due to late night time of the shift,the proper premium rate will be used instead of the normal pay rate.

After the required real labor cost is expressed, many other penalty costterms can be expressed if the user has configured the system to considerthat particular component in the objective function. In 702, theschedule consistency cost is expressed as a penalty cost due todeviation from a worker's typical week. Let x_(i,j)=1 if worker i wasassigned to shift j in his typical week and 0 otherwise. Let c_(i,c) bea dollar amount that the system is willing to pay for one shiftdifference for worker i compared to his/her typical week. The followingpenalty (e.g., a consistency penalty) is added to the total cost due toschedule inconsistency C₂=Σ_(i∈W)Σ_(j∈S)c_(i,c)|x_(i,j)−x_(i,j) ^(t)|.This means that if a worker gets identical shift assignment as his/hertypical week, there is no consistency penalty, otherwise, per shiftdifference penalty is incurred.

When multiple workers are qualified and available for a shift, if allother factors are equal the system would like to assign the shift to theworker with the best skill level match (e.g., a worker with skill of 9out of 10 would get assigned over another worker with skill of 5 out 10skill for that job). In 704, a worker below or above average skillcost/incentive is expressed. For example, let c_(i,r) be the dollaramount incentive or penalty that the system is willing to pay forassigning worker i to a shift that requires role r, where c_(i,r)=0 inthe event that the worker has the average skill proficiency for therole, c_(i,r)≥0 in the event that the worker has below averageproficiency level, and c_(i,r)≤0 in the event that the worker has aboveaverage proficiency level. The cost (e.g., or incentive if a negativenumber) of assigning workers by skill proficiency is C₃=Σ_(r)Σ_(i∈W)Z_(j∈S) _(r) c_(i,r)x_(i,j), where set S_(r) is the set of shiftcandidates that need role r.

In 706, a worker day of the week and time of the day preferenceviolation cost is expressed. For example, let c_(i,T) be the dollaramount penalty that the system is willing to pay for violating a singletiming preference for worker i and λ_(i,j)=1 in the event shift jrespects worker i's preferences and 0 otherwise. The cost due toviolating employee timing preferences isC₄=Σ_(i∈W)Σ_(j∈S)c_(i,T)(1−λ_(i,j))x_(i,j).

In 708, a worker total weekly hours preference violation cost isexpressed. For example, let C_(i,H) be the dollar amount penalty thatthe system is willing to pay for each hour of violating a worker i'spreferred number of hours per week preference, and σ_(i) be thepreferred number of hours each week for worker i. The total cost due toviolating workers' target hour preferences is C₅=Σ_(i∈W)Σ_(L∈T)c_(i,H)|σ_(i)−Σ_(j∈L)x_(i,j)(β₁−α_(j)−b_(j))|

In 710, a worker's job role preference violation cost is expressed. Letω_(i,j)=1 in the event shift j respects worker i's job role preferenceand 0 otherwise. Let c_(i,P) be the dollar amount penalty that thesystem is willing to pay for each shift of violating worker i's job rolepreference. The total cost of violating workers' job role preferences isC₆=Σ_(i∈W)Σ_(j∈S) c_(i,P)(1−ω_(i,j))x_(i,j).

In 712, the penalty cost from relaxing some of the soft constraints isexpressed. It is typically expressed as the difference between the lefthand of the constraint and the right hand of the constraint multipliedby a unit violation penalty cost, such as the penalty for violatingmaximum weekly hours constraints: c_(i) ^(H) max(0,Σ_(j)x_(i,j)(β_(j)−α_(j)−b₁)−H_(i)). It is referred to as C₇.

In 714, the objective function of the total schedule cost is expressedas the summation of the all the cost components of the FIG. 7 , i.e.,C=C₁+C₂+C₃+C₄+C₅+C₆+C₇.

FIG. 8 is a flow diagram illustrating an embodiment of a process forexpressing a set of constraints in the shift design and shift assignmentproblem. In some embodiments, the process of FIG. 8 implements 610 ofFIG. 6 . In the example shown, in 800 the three categories of hardconstraints that cannot be relaxed are expressed: the workeravailability constraint, the worker qualification constraint and thenon-overlap shift constraint. In any user configuration, the threecategories of hard constraints will always exist (cannot be turned off)and cannot be relaxed. The system transforms the input data to generatethe constraints enabling the use of an optimization calculation.

The worker availability constraint in 800 expresses that if a shift'sduration is not fully contained in one of the available time slots for aworker, that worker cannot be assigned to that shift, e.g., if(α_(j),β_(j))∈{s_(i,k),e_(i,k)} for all k⇒x_(i,j)=0, for all i∈W, j∈S,where α_(j)β_(j) are the start/end time of shift j and s_(i,k), e_(i,k)are the start/end time of one of the kth availability slot for worker i.

The worker qualification constraints in 800 expresses that a worker isassigned to a shift only if the worker is qualified for the rolerequired for the shift, e.g., if r_(j)∈R_(i)⇒x_(i,j)=0 for all i∈W, j∈S,where r_(j) is the role required by shift j and R_(i) is the set ofroles that the worker i is qualified for.

The shift non-overlap constraints in 800 express that when a worker isassigned to two shifts, the start time of the later shifts must begreater than the end time of the earlier shift by the amount of arequired rest period T_(R), e.g., if (α_(j), β_(j)+T_(R))∩(α_(k),β_(k))≠Ø=x_(i,j)+x_(i,k)≤1 for all i∈W and j, k∈S. In variousembodiments, the shift non-overlap constraint can be used to model anyone or more of: whether two or more shifts are allowed for a worker inthe same day, a minimum break between two shifts for a worker, or anyother appropriate constraint.

Other than the hard constraints, other constraints can be configured bythe user as on or off. If a constraint is off, it means that the systemdoes not need to consider it either as a constraint or in the objectivefunction. For example, if there is no union contract or company policythat guarantees minimum number of hours per week, the minimum weeklyhours constraint would be off. When a constraint is on, it can befurther configured by the user as whether it is allowed to be relaxed ornot. A constraint that is allowed to be relaxed can be moved to theobjective function as a penalty term when no feasible solution is found.

In 802, the demand coverage constraints express that when adding up allthe workers on the selected shift candidates used in the final schedule,it should supply the number of workers within the prescribed range foreach role type r and each demand period l. Let d_(r,l) and D_(r,l) bethe minimum and maximum number of workers working as role type r neededin demand period l, and a_(j,r,l)=1 in the event that shift j supply aworker of type r in demand period l, 0 otherwise. The constraint iswritten as d_(r,l)≤Σ_(j)a_(j,r,i,l)y_(j)≤D_(r,l)∀r, l. The demandcoverage constraint is always required to be on and can be relaxed asneeded. This constraint will force the proper subset of the shiftcandidates be selected so that the labor demand is covered.

Selecting the proper subset of the shift candidates to use in the finalschedule is not enough. The system also has to ensure that all selectedshift candidates are properly staffed (assigned to worker). In 804,staffing all selected shift candidates with a worker is expressed as atleast one worker should assigned to each selected shift candidate, i.e.,Σ_(i∈W)x_(i,j)≥y_(j) for j∈S. This constraint combines the shiftdesign/selection problem with shift assignment problem into a singleoptimization problem. This constraint of staffing all selected shift isrequired to be on and can be relaxed as needed.

In 806, worker minimum and maximum weekly hours constraints areexpressed. Let h_(i) and H_(i) be the minimum and the maximum number ofhours per week for worker i, and b_(j) be the amount of unpaid breaktime during shift j. A worker minimum and maximum hours constraint canthen be expressed as h_(i)≤Σ_(j∈L)x_(i,j)(β_(i)−α_(j)−b₁)≤H_(i) for alli∈W, L∈T. The min/max weekly hours constraints are optional (can beconfigured either on or off) and they can be relaxed as needed.

In 808, weekly budget constraint is expressed. From the previous laborcost expression, the budget constraint can be expressed asC₁=Σ_(i∈w){E_(l∈T)t_(i,l)p_(i)+[Σ_(l∈T) max(0, t_(i,l)−q_(D))+Σ_(L∈T)max(0, t_(i,L)−q_(W)−Σ_(l∈L) max(0, t_(i,l)−q_(D)))](θ−1)p_(i)}≤B_(L)for all L∈T, wherein B_(L) is the budget for week L. The budgetconstraints can also be expressed at the level lower than the entireschedule, such as at each job role level, or at the sub-organizationlevel (such as departments within a store). The budget constraints areoptional and can be relaxed as needed.

From time to time, an organization may guarantee their workers a certainnumber days off per week or a certain number days with work per week. In810, working a given number of days per week constraints are expressed.Let W_(F) be the set of workers for whom the system enforces that thenumber of working days per week being within [n_(m),n_(M)]. Theconstraint can be expressed as n_(m)≤Σ_(j∈L)x_(i,j)≤n_(M) for alli∈W_(F), L∈T. When n_(m)=n_(M)=5, five working days a week for a typicalfull-time worker is achieved. The number of working days a weekconstraint is optional and can be relaxed.

Some companies guarantee their workers days off each week that areconsecutive days. In 814, a number of consecutive days off constraintsare expressed. Let binary variable z_(i,l)=1 in the event that worker igets day l and day l+1 of the week off. A two consecutive days offconstraint can be expressed as Σ_(l∈L) z_(i,l)=1 for all i∈W_(F), L∈Tand (Σ_(j∈S) _(l) x_(i,j)+Σ_(j∈S) _(l+1) x_(i,j))≤2(1−z_(i,j)) for alli∈W_(F), l∈L∈T, wherein S_(l) is the set of shifts on day l (i.e., noshifts are assigned to the worker during his/her two-day off period).The two consecutive days off constraints are optional and can berelaxed.

The constraints in FIG. 8 are for illustration purpose. This system isnot limited to the constraints mentioned in FIG. 8 . With the twocategories of main decision variables x_(i,j), y_(j) and potential othersupplemental decision variables, the system can transform input datainto almost any relevant constraints (e.g., any appropriate constrainfor workforce scheduling).

FIG. 9 is a diagram illustrating an embodiment of a user interface foradjusting relative importance of certain penalty cost terms in theobjective function to achieve the desired schedule quality as indicatedin step 622 of FIG. 6 . In the example shown, the objective functionused by the solver to find an optimal solution may contain informationalong many dimensions in addition to the actual schedule cost. This way,the shape of the schedule can be influenced based on the relativeimportance of various considerations. For example, a penalty cost may beincluded if some of the employee's preferences are not respected, if theschedule is not consistent (same pattern) from one week to the next foremployees, etc. In some embodiments, the user interface of FIG. 9 isinteracted with using manager interface 204 of FIG. 2 . In the exampleshown, the user interface uses slider bars to give each dimension of theobjective function its proper weight of consideration when determiningthe optimal schedule. For example, worker preferences slide bar 900indicates a weighting of worker preferences for scheduling generation of75%; consistency slide bar 902 indicates a weighting of consistency forscheduling generation of 30%; and labor cost slide bar 904 indicates aweighting of labor cost for schedule generation of 90%. A user interfacebutton of generate schedule 906 enables a user to indicate to generate aschedule. The weightings are used in the corresponding term of theobjective function used by the solver during the process of determiningthe optimal or near optimal solution so that it makes the propertrade-off decision based on the given relative importance of eachfactors. Even though only three dimensions are used in FIG. 9 toillustrate the relative weighting adjustment, any penalty term that canappear in the objective function can be adjusted this way with a similarinterface.

FIG. 10 is a flow diagram illustrating a process for shift design andshift assignment. In some embodiments, the process of FIG. 10 isexecuted using scheduling engine 106 of FIG. 1 . In the example shown,in 1000 labor demand data is received. For example, labor demand data isreceived indicating workers needed—for example, how many workers areneeded in hourly slots during a day. In various embodiments, the labordemand data includes a demand worker type, a number of workers needed, ademand start time and a demand end time, and/or any other appropriatelabor demand parameter. In some embodiments, the labor demand datacomprises a minimum number to a maximum number of required workers for aperiod of time. In 1002, worker data is received. For example, datarelated to workers is received. In various embodiments, the worker dataincludes worker availability data, worker qualification data, workercost data, and/or any other appropriate data related to a worker. In1004, scheduling configuration data is received. For example,configuration data related to scheduling is received. In variousembodiments, the scheduling configuration data includes labor laws data,union contract data, company policy data, business condition data,penalty cost data, and/or any other appropriate data related to scheduleconfiguration.

In 1006, a set of shift candidates is generated. For example, the set ofshift candidates is generated based at least in part on labor laws,union contract, and company policy. In various embodiments, the set ofshift candidates comprise a full enumeration of all possible shifts, aset of more useful shifts (e.g., as generated using a predetermined setor using a heuristic), or any other appropriately determined set ofshift candidates. In some embodiments, the set of shift candidate isgenerated using a heuristic. In some embodiments, the set of shiftcandidates are generated one at time through a heuristic wherein theheuristic can be either a full enumeration of all possible shiftscovering at least part of the labor demand or a common sense heuristicto only produce the more useful shifts, and such each generated shiftcandidate can be evaluated, independent of the shift selection and shiftassignment decisions, with respect to the conformance to the relevantlabor law, union contract and company policy that govern single shift.In some embodiments, the heuristic generates shifts that include a mealbreak placed at a time point allowed by labor law when a shift durationis long enough to require a meal break. In some embodiments, theheuristic generates shifts in which one worker of the given role type(s)provides coverage for an entire shift duration except a meal breakperiod when the meal break is part of that shift. In some embodiments,the heuristic generates shifts that are at least as long as a minimumlength shift and no longer than a maximum length shift. In someembodiments, the heuristic generates shifts comprise up to all possibleshifts for satisfying at least part of the labor demand. In someembodiments, a shift of the set of shift candidates is associated with arole or multiple roles for workers that are crossed trained to playmultiple roles.

In 1008, a set of decision variables is determined representing whethera particular shift candidate is selected in a final schedule and whethera particular worker is assigned to the particular shift candidate. Forexample, the set of decision variables includes which subset of theshift candidates should be used in the final optimal schedule and whichworker should be assigned to which shift. In some embodiments, for aworker i of the set of N workers and a shift candidate j of the set of Mshift candidates, binary decision variable is defined as y_(j)=1 in theevent that shift candidate j is selected in the final schedule andy_(j)=0 otherwise, and further the binary decision variable is definedas x_(i,j)=1 in the event that worker i is assigned to shift candidate jand x_(i,j)=0 otherwise.

In 1010, a cost function is determined, wherein the cost function isexpressed at least in part in terms of the set of decision variables, aworker cost data of the worker data, and the scheduling configurationdata. For example, the cost function of the schedule comprises the realcost of paying the workers for the schedule and a soft penalty cost thatmeasures the desirability of the schedule along many dimensions. In someembodiments, the real cost of the schedule comprises the sum of a normalpay cost (e.g., a cost related to the normal—for example, non-overtimeand non-premium-time pay) and/or an overtime pay cost and other premiumpay (e.g., shift hours at late night may be paid at higher than normal).In various embodiments, the soft penalty cost comprises, for example, aschedule consistency cost (e.g., a cost associated with assigning aworker an inconsistent week to week schedule), a worker below averageskill proficiency cost (e.g., a cost associated with assigning a belowaverage skilled worker to a shift), a worker day and time preferenceviolation cost (e.g., a cost associated with assigning an employee to ashift outside of his/her days of the week or time of the daypreferences), a worker weekly scheduled time preference violation cost(e.g., a cost associated with assigning a worker to a weekly scheduledtime below or above of his/her weekly scheduled time preferences), aworker job role preference violation cost (e.g., a cost associated withassigning a worker to a shift associated with job role outside ofhis/her preferred role when the worker is qualified for multiple roles),and/or any other appropriate costs. In various embodiments, the costfunction comprises one or more of the following: a real labor cost, anormal pay cost, an overtime pay cost, a premium time pay cost, aschedule consistency penalty cost, a worker skill level match cost, aworker timing preference cost, a worker preferred weekly total hourscost, a worker preferred role cost, a soft constraint violation penaltycost, and/or any other appropriate cost.

In some embodiments, the cost is generated as described in FIG. 7 above.

In 1012, a set of constraints is determined, wherein the set ofconstraints comprises hard constraints and soft constraints, wherein theset of constraints is based at least in part on terms of the set ofdecision variables, the set of shift candidates, the worker data, thelabor demand data, and the scheduling configuration data. For example,the set of constraints is expressed in terms of the decision variablesand other known values (called parameter) of the given problem (e.g., aworker's hourly pay rate) in the form of a set of equalities orinequalities. For example, to ensure that a worker is only assigned to ashift for which he is qualified, the following constraint can be addedto the solver: x_(i,j)=0 in the event worker i does not have thequalification needed for shift candidate j. To respect worker'savailability, the following constraint can be added to the solver:x_(i,j)=0 in the event the entire duration of shift candidate j is notfully contained in at least one of the available time segments of workeri. To ensure that a worker i is not assigned to work in both shift j andshift k that overlap, the following constraint can be added to thesolver: x_(i,j)+x_(i,k)≤1. In some embodiments, all relevant constraintsin the shift design and shift assignment problem are determined in theform of a set equalities or inequalities in terms of the decisionvariables x_(i,j) and y_(j) and the input data. In various embodiments,the set of constraints comprises one or more of the following: a workeravailability constraint, a worker qualification constraint, a shiftnon-overlap constraint, a demand coverage constraint, a staff selectedshift constraint, a min/max weekly hours constraint, a budgetconstraint, a number of working days per week constraint, a consecutiverest days constraint, and/or any other appropriate constraint.

In some embodiments, the constraints are generated as described in FIG.8 above.

In 1014, a subset of the shift candidates selected in the final scheduleand a set of shift assignments of which worker is assigned to whichselected shift candidate of the subset of the shift candidates aredetermined simultaneously, using either a SAT solver, a MP solver, or aMIP solver, such that the hard constraints are fully respected,violations to the soft constraints are minimized, and the cost functionis minimized. In some embodiments, the subset of shift candidates isselected so that in every time period a number of required workers withappropriate qualifications is assigned. In various embodiments, thesubset of the shift candidates and the set of shift assignments aredetermined to try to optimize an objective function, which can eitherminimize a total cost (e.g., a real cost plus a penalty cost) ormaximize total profitability (e.g., a real profit plus an incentivemeasure including an employee happiness).

FIG. 11 is a flow diagram illustrating an embodiment of a process forgenerating a set of shift candidates. In some embodiments, the processof FIG. 11 is used to implement 1006 of FIG. 10 . In the example shown,in 1100 a full enumeration set of shift candidates or a set of usefulshift candidates are generated. For example, a full set of shifts thatspan all possible shift lengths/start times in a day are generated, afull set of shifts that would satisfy the labor demand that span allpossible shift lengths/start times in the labor demand are generated, aset of shifts that comprise practical shifts (e.g., longest shiftswithin labor demand, shifts in practical lengths—for example, full days,half days, etc.), or any other appropriate shifts. In 1102, a next shiftcandidate of the set of shift candidates is selected. For example, afirst candidate or next one in the set is selected. In 1104, it isdetermined whether a selected shift candidate complies with the rules.For example, it is determined whether the shift candidate complies withlabor laws, organization rules, union rules, etc. In 1106, in the eventthat the selected shift candidate does not comply with the rules, do notadd selected shift to the final set of shift candidates, and controlpasses to 1110. In 1108, in the event that the selected shift candidatedoes comply with the rules, add selected shift to the final set of shiftcandidates, and control passes to 1110. In 1110, it is determinedwhether there are more shift candidates. For example, it is determinedwhether all the shift candidates have been evaluated for compliance withthe rules. In the event that there are more shift candidates, controlpasses to 1102. In the event that there are no more shift candidates,control passes to 1112. In 1112, the final set of shift candidates isprovided, and the process ends. For example, the final set of shiftcandidates is provided to the next step of processing.

FIG. 12 is a flow diagram illustrating a process for determining asolution. In some embodiments, the process of FIG. 12 is used toimplement 1014 of FIG. 10 . In the example shown, in 1200 hardconstraints, soft constraints, and a cost function are received. In1202, the solver is executed. For example, using the hard constraints,soft constraints, and cost function that have been determinedappropriately for a SAT solver, a MP solver, or MIP solver, determine asolution, if any, and a solution metric associated with the solution. In1204, it is determined whether the solution exists. In response todetermining that no solution exists, control passes to 1205. In 1205, itis determined whether constraints can be modified. In response todetermining that the constraints can be modified, control passes to1206. In 1206, the soft constraints are modified and control passes to1202. For example, the soft constraints are relaxed by removing from theconstraint set and the constraint violation terms being added to theobjective function and the solver is re-executed to determine a newsolution. In response to determining that constraints cannot bemodified, control passes to 1207. In 1207, it is indicated that there isno solution, and the process ends.

In response to determining that a solution exists in 1204, controlpasses to 1208. In 1208, it is determined whether the solution metric isabove a threshold. For example, the solution metric is compared to aquality threshold to determine whether the closeness of the solution tothe target cost is sufficient. In response to determining that thesolution metric is not above the threshold, control passes to 1209. In1209, it is determined whether cost can be modified. In response todetermining that cost can be modified, control passes to 1210. In 1210,the cost function is modified, and control passes to 1202. For example,one or more penalty costs are modified within the overall cost functionand the solver is re-executed to determine a new solution. In responseto determining that cost cannot be modified, control passes to 1211. In1211, in its indicated that cost is high, and the process ends.

In response to the solution metric being above the threshold in 1208,control passes to 1212. In 1212, the solution is provided, and theprocess ends. For example, the solution including a shift assignment andshift determination is provided.

Although the foregoing embodiments have been described in some detailfor purposes of clarity of understanding, the invention is not limitedto the details provided. There are many alternative ways of implementingthe invention. The disclosed embodiments are illustrative and notrestrictive.

1. A system for shift design and assignment, comprising: an interfaceconfigured to: receive worker data, wherein the worker data includespreferred days and available days; and receive scheduling configurationdata, wherein the scheduling configuration data is input using controlsto adjust worker preferences; and a processor configured to: execute, bya software application, a schedule creation request; generate a set ofshift candidates; determine a set of decision variables representingwhether a particular shift candidate is selected in a final schedule andwhether a particular worker is assigned to the particular shiftcandidate; determine a cost function, wherein the cost function isexpressed at least in part in terms of the set of decision variables, aworker cost data of the worker data, and the scheduling configurationdata; determine a set of constraints, wherein the set of constraintscomprises hard constraints and soft constraints, wherein the set ofconstraints is based at least in part on the set of decision variables,the set of shift candidates, the worker data, a labor demand data, andthe scheduling configuration data; and determine simultaneously, usingeither a SAT solver, MP solver, or a MIP solver, a subset of the shiftcandidates selected in the final schedule, wherein the simultaneouslydetermined subset of shift candidates and set of shift assignments fullyrespects the hard constraints and optimizes an objective functioncomprising the cost function and at least one constraint violation termadded to the objective function in response to relaxing a softconstraint of the soft constraints.
 2. The system of claim 1, whereinthe labor demand data includes a demand worker type, a number of workersneeded, and a demand start time and a demand end time.
 3. The system ofclaim 1, wherein the worker data includes worker availability data,worker qualification data, and worker cost data.
 4. The system of claim1, wherein the scheduling configuration data includes labor laws data,union contract data, company policy data, business condition data, andpenalty cost data.
 5. The system of claim 1, the set of shift candidatesis generated based at least in part on labor laws, union contract, andcompany policy.
 6. The system of claim 1, wherein the set of shiftcandidates comprise a full enumeration of all possible shifts or a setof more useful shifts.
 7. The system of claim 6, wherein the set ofshift candidate is generated using a heuristic.
 8. The system of claim7, wherein the heuristic generates shifts that include a meal breakplaced at a time point allowed by labor law when a shift duration islong enough to require a meal break.
 9. The system of claim 7, whereinthe heuristic generates shifts in which one worker of a given roletype(s) provides coverage for an entire shift duration except a mealbreak period when the meal break is part of that shift.
 10. The systemof claim 7, wherein the heuristic generates shifts that are at least aslong as a minimum length shift and no longer than a maximum lengthshift.
 11. The system of claim 7, wherein the heuristic generates shiftsthat comprise up to all possible shifts for satisfying at least part ofthe labor demand data.
 12. The system of claim 7, wherein a shift of theset of shift candidates is associated with a role or multiple roles forworkers that are crossed trained to play multiple roles.
 13. The systemof claim 1, wherein the labor demand data comprises a minimum number toa maximum number of required workers for a period of time.
 14. Thesystem of claim 1, wherein the subset of the shift candidates isselected so that in every time period a number of required workers withappropriate qualifications is assigned.
 15. The system of claim 1,wherein the set of constraints comprises one or more of: a workeravailability constraint, a worker qualification constraint, a shiftnon-overlap constraint, a demand coverage constraint, a staff selectedshift constraint, a min/max weekly hours constraint, a budgetconstraint, a number of working days per week constraint, and/or aconsecutive rest days constraint.
 16. The system of claim 1, wherein thecost function comprises one or more of: a real labor cost, a normal paycost, an overtime pay cost, a premium time pay cost, a scheduleconsistency penalty cost, a worker skill level match cost, a workertiming preference cost, a worker preferred weekly total hours cost, aworker preferred role cost, and a soft constraint violation penaltycost.
 17. The system of claim 1, wherein optimizing the objectionfunction comprises minimizing a total cost, maximizing a totalprofitability, or a combination thereof.
 18. The system of claim 17,wherein the total cost comprises a real cost plus a penalty cost. 19.The system of claim 17, wherein the total profitability comprises a realprofit plus an incentive measure including an employee happiness. 20.The system of claim 1, wherein determining a set of decision variablescomprises determining a first category of decision variablesrepresenting whether a particular shift candidate is selected in a finalschedule and a second category of decision variables representingwhether a particular worker is assigned to the particular shiftcandidate.
 21. The system of claim 1, wherein determining the costfunction comprises transforming input data, wherein the input datacomprises the labor demand data, the worker data, and the schedulingconfiguration data.
 22. The system of claim 1, wherein determining theset of constraints comprises transforming input data, wherein the inputdata comprises the labor demand data, the worker data, and thescheduling configuration data.
 23. A method for shift design andassignment, comprising: receiving worker data, wherein the worker dataincludes preferred days and available days; receiving schedulingconfiguration data, wherein the scheduling configuration data is inputusing controls to adjust worker preferences; executing, by a softwareapplication, schedule creation request generating a set of shiftcandidates; determining, using a processor a set of decision variablesrepresenting whether a particular shift candidate is selected in a finalschedule and whether a particular worker is assigned to the particularshift candidate; determining a cost function, wherein the cost functionis expressed at least in part in terms of a set of decision variables, aworker cost data of the worker data, and the scheduling configurationdata; determining a set of constraints, wherein the set of constraintscomprises hard constraints and soft constraints, wherein the set ofconstraints is based at least in part on the set of decision variables,the set of shift candidates, the worker data, a labor demand data, andthe scheduling configuration data; and determining simultaneously, usingeither a SAT solver, MP solver, or a MIP solver: 1) a subset of theshift candidates selected in the final schedule; and 2) a set of shiftassignments of which worker is assigned to which selected shiftcandidate of the subset of the shift candidates, wherein thesimultaneously determined subset of shift candidates and set of shiftassignments fully respects the hard constraints and optimizes anobjective function comprising the cost function and at least oneconstraint violation term added to the objective function in response torelaxing a soft constraint of the soft constraints.
 24. A computerprogram product for shift design and assignment, the computer programproduct being embodied in a non-transitory computer readable storagemedium and comprising computer instructions for: receiving worker data,wherein the worker data includes preferred days and available days;receiving scheduling configuration data, wherein the schedulingconfiguration data is input using controls to adjust worker preferences;executing, by a software application, schedule creation requestgenerating a set of shift candidates; determining, using a processor, aset of decision variables representing whether a particular shiftcandidate is selected in a final schedule and whether a particularworker is assigned to the particular shift candidate; determining a costfunction, wherein the cost function is expressed at least in part interms of a set of decision variables, a worker cost data of the workerdata, and the scheduling configuration data; determining a set ofconstraints, wherein the set of constraints comprises hard constraintsand soft constraints, wherein the set of constraints is based at leastin part on the set of decision variables, the set of shift candidates,the worker data, a labor demand data, and the scheduling configurationdata; and determining simultaneously, using either a SAT solver, MPsolver, or a MIP solver: 1) a subset of the shift candidates selected inthe final schedule; and 2) a set of shift assignments of which worker isassigned to which selected shift candidate of the subset of the shiftcandidates, wherein the simultaneously determined subset of shiftcandidates and set of shift assignments fully respects the hardconstraints and optimizes an objective function comprising the costfunction and at least one constraint violation term added to theobjective function in response to relaxing a soft constraint of the softconstraints.